package com.dmjj.cadcommon.util;

import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 王丽凯
 * @Description: TODO
 * @Title: ListCopyToVOUtil
 * @ProjectName dmjj-parent
 * @date 2018/12/25
 */
public class ListCopyToVOUtil {

    public static <T> List getListToVO(List<?> list, Class<T> t) {
        List resultList = new ArrayList();

        for(int i = 0; i < list.size(); ++i) {
            Object a = null;

            try {
                a = t.newInstance();
                BeanUtils.copyProperties(list.get(i), a);
                resultList.add(a);
            } catch (InstantiationException var6) {
                var6.printStackTrace();
            } catch (IllegalAccessException var7) {
                var7.printStackTrace();
            }
        }

        return resultList;
    }
}
